package cn.seocoo.platform.rule.service.impl;

import java.util.List;

import cn.seocoo.platform.base.dto.BaseCommonDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.seocoo.platform.rule.mapper.RuleMapper;
import cn.seocoo.platform.rule.domain.Rule;
import cn.seocoo.platform.rule.service.IRuleService;
import cn.seocoo.platform.common.core.text.Convert;

/**
 * 规则设置 服务层实现
 * 
 * @author wujian
 * @date 2019-12-30
 */
@Service
public class RuleServiceImpl implements IRuleService 
{
	@Autowired
	private RuleMapper ruleMapper;

	/**
     * 查询规则设置信息
     * 
     * @param id 规则设置ID
     * @return 规则设置信息
     */
    @Override
	public Rule selectRuleById(Integer id)
	{
	    return ruleMapper.selectRuleById(id);
	}
	
	/**
     * 查询规则设置列表
     * 
     * @param rule 规则设置信息
     * @return 规则设置集合
     */
	@Override
	public List<Rule> selectRuleList(Rule rule)
	{
	    return ruleMapper.selectRuleList(rule);
	}
	
    /**
     * 新增规则设置
     * 
     * @param rule 规则设置信息
     * @return 结果
     */
	@Override
	public int insertRule(Rule rule)
	{
	    return ruleMapper.insertRule(rule);
	}
	
	/**
     * 修改规则设置
     * 
     * @param rule 规则设置信息
     * @return 结果
     */
	@Override
	public int updateRule(Rule rule)
	{
	    return ruleMapper.updateRule(rule);
	}

	/**
     * 删除规则设置对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteRuleByIds(String ids)
	{
		return ruleMapper.deleteRuleByIds(Convert.toStrArray(ids));
	}


	/**
	 * @Author WuJian
	 * @Description //根据规则查询类型
	 * @Date 20:11 2019/12/30
	 * @Param [type]
	 * @return cn.seocoo.platform.base.dto.BaseCommonDto
	 **/
	@Override
	public BaseCommonDto selectRuleByType(String type) {
		return ruleMapper.selectRuleByType(type);
	}

}
